#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
#define PI 3.14159265

void fun(double angle1, double angle2, double angle3, double d)
{
	double r1 = d / (2 * sin(angle1 * PI / 180));
	double XA = sqrt(r1 * r1 - d * d / 4);
	double YA = d / 2;
	printf("(x - %lf)^2 + (y - %lf)^2 = %lf\n", XA, YA, r1 * r1);
	double r2 = d / (2 * sin(angle2 * PI / 180));
	double XB = ((d * d * cos(angle3 * PI / 180) - 2 * d * sin(angle3 * PI / 180) * cos(angle3 * PI / 180)) * sqrt(4 * r2 * r2 - 1) + d * sin(angle3 * PI / 180) * (d - 2 * sin(angle3 * PI / 180))) / (4 * cos(angle3 * PI / 180));
	double YB = (4 * d * sin(angle3 * PI / 180) + sqrt(16 * d * d * sin(angle3 * PI / 180) * sin(angle3 * PI / 180) - 16 * d * d + 64 * r2 * r2 * cos(angle3 * PI / 180) * cos(angle3 * PI / 180))) / 8;
	printf("(x - %lf)^2 + (y - %lf)^2 = %lf\n", XB, YB, r2 * r2);
	printf("r1 = %lf, r2 = %lf, XA = %lf, YA = %lf, XB = %lf, YB = %lf\n", r1, r2, XA, YA, XB, YB);
}

int main()
{
	double angle1 = 0;
	double angle2 = 0;
	double angle3 = 0;
	double d = 0;
	while (scanf("%lf%lf%lf%lf", &angle1, &angle2,&angle3,&d) == 4)
	{
		fun(angle1,angle2,angle3,d);
	}
	return 0;
}